/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package earthdawnnet.util;

/**
 *
 * @author Andreas Franek
 */
public class Roll
{
    private int step;
    private boolean rolledAgainst;
    private int against;
    private int rolled;
    private String description;
    
    public Roll(int step, int rolled, String description)
    {
        this.step = step;
        this.rolledAgainst = false;
        this.against = 0;
        this.rolled = rolled;
        this.description = description;
    }
    
    public Roll(int step, int against, int rolled, String description)
    {
        this.step = step;
        this.rolledAgainst = true;
        this.against = against;
        this.rolled = rolled;
        this.description = description;
    }

    public int getAgainst()
    {
        if(!isRolledAgainst()) throw new IllegalAccessError("Roll was not thrown against a value!");
        return against;
    }

    public String getDescription()
    {
        return description;
    }
    
    @Override
    public String toString()
    {
        return getDescription();
    }

    public int getRolled()
    {
        return rolled;
    }

    public boolean isRolledAgainst()
    {
        return rolledAgainst;
    }

    public int getStep()
    {
        return step;
    }
}
